# -*- coding: utf-8 -*-
"""
Created on Mon Oct 23 18:52:23 2017

@author: Luther
"""
import os

path = input('请输入文件夹路径：')
path_w = os.getcwd()

file_list = os.listdir(path)

for file_name in file_list:
    try:
        code = file_name[11:17]
    except:
        code = 'error'
    with open(os.path.join(path_w, 'path.csv'), 'a') as f:
        f.write(code)
        f.write(',')
        f.write(os.path.join(path, file_name))
        f.write('\n')

print('Finish!')
